<div id="subPage" data-type="major" class="tpl-portlet-components">
  <div class="portlet-title">
    <div class="caption font-green bold">
      <span class="am-icon-code"></span>专业列表
    </div>
  </div>
  <div class="tpl-block">
    <div class="am-g">
      <div class="am-u-sm-12 am-u-md-6">
        <div class="am-btn-toolbar">
          <div class="am-btn-group am-btn-group-xs">
            <button type="button" id="add" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
          </div>
        </div>
      </div>
    </div>
    <div class="am-g">
      <div class="am-u-sm-12">
        <table class="am-table am-table-striped am-table-hover table-main">
          <thead>
            <tr>
              <th class="table-title">专业</th>
              <th class="table-date am-hide-sm-only">日期</th>
              <th class="table-set">操作</th>
            </tr>
          </thead>
          <tbody id="data-list">

          </tbody>
        </table>
        <div class="am-cf">

          <div class="am-fr">
            <ul class="am-pagination tpl-pagination" id="data-list-page">
            </ul>
          </div>
        </div>
        <hr>
      </div>
    </div>
  </div>
  <div class="tpl-alert"></div>
</div>
<div class="am-modal am-modal-no-btn" tabindex="-1" id="add-modal">
  <div class="am-modal-dialog" style="background:#fff;">
    <div class="am-modal-hd">添加专业
      <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
    </div>
    <div class="am-modal-bd">
      <div class="tpl-block ">
        <div class="am-g tpl-amazeui-form">
          <div class="am-u-sm-12 am-u-md-9">
            <form class="am-form am-form-horizontal" id="add-form">
              <div class="am-form-group">
                <label for="user-name" class="am-u-sm-3 am-form-label">专业名称</label>
                <div class="am-u-sm-9">
                  <input type="text" name="name" class="form-validator" val-data="require" val-data-msg="专业名称不能为空" placeholder="专业名称" >
                </div>
              </div>
              <div class="am-form-group">
                <div class="am-u-sm-9 am-u-sm-push-3">
                  <button type="button" id="add-submit" class="am-btn am-btn-primary">添加</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="am-modal am-modal-no-btn" tabindex="-1" id="edit-modal">
  <div class="am-modal-dialog" style="background:#fff;">
    <div class="am-modal-hd">编辑专业
      <a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
    </div>
    <div class="am-modal-bd">
      <div class="tpl-block ">
        <div class="am-g tpl-amazeui-form">
          <div class="am-u-sm-12 am-u-md-9">
            <form class="am-form am-form-horizontal" id="edit-form">
              <div class="am-form-group">
                <label for="user-name" class="am-u-sm-3 am-form-label">专业名称</label>
                <div class="am-u-sm-9">
                  <input type="hidden" name="id" >
                  <input type="text" name="name" class="form-validator" val-data="require" val-data-msg="专业名称不能为空" placeholder="专业名称" >
                </div>
              </div>
              <div class="am-form-group">
                <div class="am-u-sm-9 am-u-sm-push-3">
                  <button type="button" id="edit-submit" class="am-btn am-btn-primary">保存修改</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script id="dataListTpl" type="text/html">
  <% for(var i=0;i<$data.length;i++){ %>
    <% if(i%2==0){%>
      <tr list-data-id="<%==$data[i].id%>">
        <td>
          <%==$data[i].name%>
        </td>
        <td class="am-hide-sm-only">
          <%==$data[i].createDate%>
        </td>
        <td>
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
              <button onclick="editData('/major/update',{id:'<%==$data[i].id%>',name:'<%==$data[i].name%>'},'dataListTpl','major/list')" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
              <button onclick="deleteData('/major/del/<%==$data[i].id%>','<%==$data[i].id%>')"  class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button>
            </div>
          </div>
        </td>
      </tr>
      <%}else if(i%2==1){%>
        <tr list-data-id="<%==$data[i].id%>">
          <td>
            <%==$data[i].name%>
          </td>
          <td class="am-hide-sm-only">
            <%==$data[i].createDate%>
          </td>
          <td>
            <div class="am-btn-toolbar">
              <div class="am-btn-group am-btn-group-xs">
                <button onclick="editData('/major/update',{id:'<%==$data[i].id%>',name:'<%==$data[i].name%>'},'dataListTpl','major/list')" class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
                <button onclick="deleteData('/major/del/<%==$data[i].id%>','<%==$data[i].id%>')" class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button>
              </div>
            </div>
          </td>
        </tr>
        <%}}%>
</script>
<script src="static/js/amazeui.min.js"></script>
